<?php

include_once 'database.php';

class Admin {


    public static function getCredentials($userName) {
        $dbo = Database::getDBOInstance();
        
        $result = $dbo->mysql_query("select * from sase_admin where admin_name = '$userName'");
        
        if (mysql_num_rows($result) == 0) return FALSE;
        
        $row = mysql_fetch_assoc($result);
        
        $results = array('name' => $row['admin_name'], 'password' => $row['admin_pwd']);
        
        return $results;
    }   
    
    public static function setCredentials($credentials) {
        $dbo = Database::getDBOInstance();
        
        $admin_pwd = $credentials['username'];
        $result = $dbo ->mysql_query("update sase_admin admin_pwd = '$admin_pwd' where admin_name = '$admin_name'");
        
        if ($result) return TRUE;
        return FALSE;
    }
}

?>